package cn.com.dcsgo.api.fallback;

import cn.com.dcsgo.api.client.CartClient;
import cn.com.dcsgo.api.client.ItemClient;
import cn.com.dcsgo.api.dto.CartVO;
import cn.com.dcsgo.api.dto.ItemDTO;
import cn.com.dcsgo.api.dto.OrderDetailDTO;
import cn.com.dcsgo.exception.BizIllegalException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

@Slf4j
public class CartClientFallbackFactory implements FallbackFactory<CartClient> {
    @Override
    public CartClient create(Throwable cause) {
        log.error("cart-service调用失败", cause);
        return new CartClient() {
            @Override
            public List<CartVO> queryMyCarts(Long userId) {
                log.error("购物车查询失败!", cause);
                return Collections.emptyList();
            }
        };
    }
}
